package org.saber.geo.transshape;

import java.util.ArrayList;
import java.util.List;

import org.saber.geo.model.Point;
import org.saber.geo.utils.Location;
import org.saber.geo.utils.PlaneCoordinateUtils;

/**
 * 多边形工具
 * @author saber
 *
 */
public class PolygonUtils {

	/**
	 * 多边形缩放
	 * @param oriPointList
	 * @param scaling 缩放倍率
	 * @return
	 */
	public static List<Point> getTransPointList(List<Point> oriPointList,double scaling){
		
		List<Point> subPointList=new ArrayList<>();
		//使用重心点作为中心点
		Point pointCenter=PlaneCoordinateUtils.getCenterOfGravityPoint(oriPointList);
		for (Point oriPoint : oriPointList) {
			
			Location location=PlaneCoordinateUtils.checkLocation(pointCenter, oriPoint);
			
			Point ss=PlaneCoordinateUtils.getPoint(pointCenter,PlaneCoordinateUtils.getDistance(pointCenter, oriPoint),
					PlaneCoordinateUtils.getK(pointCenter, oriPoint), location);
			
			subPointList.add(ss);
		}
		
		return subPointList;
	}

	/**
	 * 检测坐标点是否在中心点左侧
	 * @param centerPoint
	 * @param oriPoint
	 * @return
	 */
	@Deprecated
	public static boolean isLeftCheck(Point basePoint,Point oriPoint) {
		if(basePoint.getX()>=oriPoint.getX()) {
			return true;
		}
		return false;
		
		
	}
	
	
	
	
	
}
